<script>
import { login } from '@/services/';
export default {
    onLaunch: async function () {
        // 清除登陆态
        wx.setStorageSync('access_token', '');
        wx.login({
            success: async (res) => {
                if (res.errMsg === 'login:ok') {
                    let result = await login(res.code);
                    // 存储登陆态
                    if (result.access_token) {
                        wx.setStorageSync(
                            'access_token',
                            result.token_type + result.access_token
                        );
                    }
                }
            },
        });
    },
    onShow: function () {},
    onHide: function () {},
};
</script>

<style>
/*每个页面公共css */
</style>
